//
//  ImageDetailCell.m
//  JadeShop
//
//  Created by mac on 2019/3/18.
//  Copyright © 2019年 SZJ.test. All rights reserved.
//

#import "ImageDetailCell.h"
#import "Tool.h"
@implementation ImageDetailCell
{
    __weak IBOutlet UIScrollView *_scrollView;
    __weak IBOutlet UIImageView *_img;
    
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
   _scrollView.delegate = self;
   
}

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
    return _img;
}


// called before the scroll view begins zooming its content缩放开始的时候调用
- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(nullable UIView *)view NS_AVAILABLE_IOS(3_2){
}

// scale between minimum and maximum. called after any 'bounce' animations缩放完毕的时候调用。
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(CGFloat)scale

{

    [_scrollView setZoomScale:scale animated:NO];
}

// 缩放时调用
- (void)scrollViewDidZoom:(UIScrollView *)scrollView{
    // 可以实时监测缩放比例
    NSLog(@"......scale is %f",scrollView.zoomScale);
    
}


-(void)setModel:(BaseModel *)model{
    ImageModel *_model = model;
    _img.image = _model.thumImage;
}

+(CGSize)cellHeight:(BaseModel *)model{
    return CGSizeMake(YYScreenWidth() + 20, YYScreenHeight());
}

@end
